package com.hxzy.front.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * springmvc配置
 */
@Configuration
public class WebConfig extends WebMvcConfigurationSupport {

    /**
     * 构建一个java http请求库
     * @return
     */
    @Bean
    public RestTemplate restTemplate(){
        return  new RestTemplate();
    }


    /**
     * 添加静态资源
     * @param registry
     */
    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/");
    }
}
